home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 4 / The Arsenal Files 4 (Arsenal Computer).ISO / ham / sattrk31.tgz / sattrack-3.1.tar / SatTrack / src / sattrack / satlice.c < prev    next >
C/C++ Source or Header  |  1995-03-17  |  8KB  |  186 lines

  1. /******************************************************************************/
  2. /*                                                                            */
  3. /*  Title       : satlice.c                                                   */
  4. /*  Author      : Manfred Bester                                              */
  5. /*  Date        : 10Feb95                                                     */
  6. /*  Last change : 16Mar95                                                     */
  7. /*                                                                            */
  8. /*  Synopsis    : This function block deals with the license issues.          */
  9. /*                Please do not alter these functions!                        */
  10. /*                                                                            */
  11. /*                Instead of tampering with this module, look into the        */
  12. /*                documentation to find out how to suppress the               */
  13. /*                'registration via email'.                                   */
  14. /*                                                                            */
  15. /*                                                                            */
  16. /*  SatTrack is Copyright (c) 1992, 1993, 1994, 1995 by Manfred Bester.       */
  17. /*  All Rights Reserved.                                                      */
  18. /*                                                                            */
  19. /*  Permission to use, copy, and distribute SatTrack and its documentation    */
  20. /*  in its entirety for educational, research and non-profit purposes,        */
  21. /*  without fee, and without a written agreement is hereby granted, provided  */
  22. /*  that the above copyright notice and the following three paragraphs appear */
  23. /*  in all copies. SatTrack may be modified for personal purposes, but        */
  24. /*  modified versions may NOT be distributed without prior consent of the     */
  25. /*  author.                                                                   */
  26. /*                                                                            */
  27. /*  Permission to incorporate this software into commercial products may be   */
  28. /*  obtained from the author, Dr. Manfred Bester, 1636 M. L. King Jr. Way,    */
  29. /*  Berkeley, CA 94709, USA. Note that distributing SatTrack 'bundled' in     */
  30. /*  with ANY product is considered to be a 'commercial purpose'.              */
  31. /*                                                                            */
  32. /*  IN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, */
  33. /*  SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF   */
  34. /*  THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHOR HAS BEEN ADVISED  */
  35. /*  OF THE POSSIBILITY OF SUCH DAMAGE.                                        */
  36. /*                                                                            */
  37. /*  THE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT      */
  38. /*  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A   */
  39. /*  PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS"      */
  40. /*  BASIS, AND THE AUTHOR HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, */
  41. /*  UPDATES, ENHANCEMENTS, OR MODIFICATIONS.                                  */
  42. /*                                                                            */
  43. /******************************************************************************/
  44.  
  45. #include <math.h>
  46. #include <stdio.h>
  47. #include <string.h>
  48.  
  49. #ifndef STDLIB
  50. #include <stdlib.h>
  51. #endif
  52.  
  53. #include "satglobalsx.h"
  54. #include "sattrack.h"
  55.  
  56. #ifdef HPTERM
  57. #include "hpterm.h"               /* definitions of hpterm macros             */
  58. #else
  59. #include "vt100.h"                /* definitions of VT100 macros              */
  60. #endif
  61.  
  62. /******************************************************************************/
  63. /*                                                                            */
  64. /* checkLicense: don't tamper with this function since this might cause       */
  65. /*               trouble elsewhere!                                           */
  66. /*                                                                            */
  67. /******************************************************************************/
  68.  
  69. void checkLicense()
  70.  
  71. {
  72.     int  rFlag;
  73.     char rStr[80];
  74.  
  75.     sprintf(licenseFile,"%s/.sattrack",strpRgst);
  76.  
  77.     if ((fpr = fopen(licenseFile,"r")) != NULL)
  78.     {
  79.         fclose(fpr);
  80.         return;
  81.     }
  82.  
  83.     sprintf(sattrackTitle,"%s %s --- License #%d",sattrName,sattrVersion,LCNUM);
  84.     printf("\n%s %s\n",sattrName,sattrVersion);
  85.     printf("\nCopyright (c) 1992, 1993, 1994, 1995 by Manfred Bester.\n");
  86.     printf("All Rights Reserved.\n");
  87.  
  88.     reverseBlink();
  89.     printf("\n Congratulations! \n");
  90.     normal();
  91.     printf("\nYou acquired and successfully installed %s.\n\n",sattrackTitle);
  92.  
  93.     printf("There is no license required for private, non-commercial use.\n");
  94.     printf("However, if you intend to use this software or parts of it\n");
  95.     printf("commercially, please contact the author.\n\n");
  96.  
  97.     printf("Even for non-commercial applications it would make sense to\n");
  98.     printf("register your copy of SatTrack with the author, so that you\n");
  99.     printf("can be informed about future upgrades or fixes of bugs.\n\n");
  100.  
  101.     doBeep();
  102.     rFlag = FALSE;
  103.  
  104.     while (!rFlag)
  105.     {
  106.         printf("Would you like to register your copy of SatTrack now (y/n) ? ");
  107.         mGets(rStr,80,stdin);
  108.         upperCase(rStr);
  109.  
  110.         if (!strncmp(rStr,"N",1) || !strncmp(rStr,"Y",1))
  111.             rFlag = TRUE;
  112.     }
  113.  
  114.     if (!strncmp(rStr,"Y",1))
  115.     {
  116.         rFlag = FALSE;
  117.  
  118.         while (!rFlag)
  119.         {
  120.             printf("Can your computer send electronic mail   ");
  121.             printf("            (y/n) ? ");
  122.             mGets(rStr,80,stdin);
  123.             upperCase(rStr);
  124.  
  125.             if (!strncmp(rStr,"N",1) || !strncmp(rStr,"Y",1))
  126.                 rFlag = TRUE;
  127.         }
  128.  
  129.         if (!strncmp(rStr,"Y",1))
  130.         {
  131.             if ((fpr = fopen(licenseFile,"w")) == NULL)
  132.             {
  133.                 printf("Cannot create license file.\n\n");
  134.                 exit(-1);
  135.             }
  136.  
  137.             else
  138.             {
  139.                 fprintf(fpr,"Registration of %s\n",sattrackTitle);
  140.                 fclose(fpr);
  141.             }
  142.  
  143.             printf("\nTrying to send registration via email ...\n");
  144.             mailRegistration();
  145.             printf("\nThanks for your registration!\n\n");
  146.         }
  147.  
  148.         else
  149.             printf("\nCannot send registration via email!\n\n");
  150.  
  151.         printf("Starting SatTrack any moment ...\n");
  152.         milliSleep(950);
  153.     }
  154.  
  155.     else
  156.     {
  157.         printf("\nWell, maybe some other time.\n");
  158.         printf("\nStarting SatTrack any moment ...\n");
  159.         milliSleep(950);
  160.     }
  161.  
  162.     return;
  163. }
  164.  
  165. /******************************************************************************/
  166. /*                                                                            */
  167. /* mailRegistration: sends registration message                               */
  168. /*                                                                            */
  169. /******************************************************************************/
  170.  
  171. void mailRegistration()
  172.  
  173. {
  174.     char mStr[120];
  175.  
  176.     sprintf(mStr,"mail %s < %s",REGMAIL,licenseFile);
  177.     system(mStr);
  178.     return;
  179. }
  180.  
  181. /******************************************************************************/
  182. /*                                                                            */
  183. /* End of function block satlice.c                                            */
  184. /*                                                                            */
  185. /******************************************************************************/
  186.